﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class provider_HomeRefinancing_HomeRefinancing : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
        {
            Request.Browser.Adapters.Clear();
        }

        if (Session[CE.Global.General.Guest] == null)
        {
            Response.Redirect("~/Default.aspx");
        }
        else if (Session[CE.Global.General.Guest].ToString() == "Provider")
        {
            if (Session[CE.Global.General.UserId] == null)
            {
                Response.Redirect("~/Provider/ProviderSecureLogin.aspx");
            }
        }

        //May Bank
        if (Session[CE.Global.General.ProviderCompanyId].ToString() == CE.Configuration.MyConfigurationManager.GetAppSettingValue("MayBankProviderCompanyId"))
        {
            imgLogo.ImageUrl = "~/Provider/images/logos/maybank.png";
            imgLogo.ToolTip = "MayBank";
            imgLogo.AlternateText = "MayBank";
            DateTime _dtLastLoginTime = new DateTime(2000, 12, 12);
            if (Session[CE.Global.General.LastLoginTime] != null)
            {
                _dtLastLoginTime = Convert.ToDateTime(Session[CE.Global.General.LastLoginTime]);
                divProviderInfo.InnerHtml = "Welcome " + Session[CE.Global.General.UserName].ToString() + ", MayBank Singapore<br /><span>Last login date : " + _dtLastLoginTime.ToShortDateString() + " " + _dtLastLoginTime.ToShortTimeString() + "</span>";
            }
            else
            {
                divProviderInfo.InnerHtml = "Welcome " + Session[CE.Global.General.UserName].ToString() + ", MayBank Singapore<br /><span>Last login date : first time </span>";
            }

            litTitlePage.Text = "MayBank";

        }
        //Standar Chartered
        else if (Session[CE.Global.General.ProviderCompanyId].ToString() == CE.Configuration.MyConfigurationManager.GetAppSettingValue("STDCProviderCompanyID"))
        {
            imgLogo.ImageUrl = "~/Provider/images/logos/standchart.png";
            imgLogo.ToolTip = "Standar Chartered";
            imgLogo.AlternateText = "Standar Chartered";

            DateTime _dtLastLoginTime = new DateTime(2000, 12, 12);
            if (Session[CE.Global.General.LastLoginTime] != null)
            {
                _dtLastLoginTime = Convert.ToDateTime(Session[CE.Global.General.LastLoginTime]);
                divProviderInfo.InnerHtml = "Welcome " + Session[CE.Global.General.UserName].ToString() + ", Standar Chartered Singapore<br /><span>Last login date : " + _dtLastLoginTime.ToShortDateString() + " " + _dtLastLoginTime.ToShortTimeString() + "</span>";
            }
            else
            {
                divProviderInfo.InnerHtml = "Welcome " + Session[CE.Global.General.UserName].ToString() + ", Standar Chartered Singapore<br /><span>Last login date : first time </span>";
            }

            litTitlePage.Text = "Standar Chartered";
        }

            //RHB Bank
        else if (Session[CE.Global.General.ProviderCompanyId].ToString() == CE.Configuration.MyConfigurationManager.GetAppSettingValue("RHBProviderCompanyID"))
        {
            imgLogo.ImageUrl = "~/Provider/images/logos/rhb.png";
            imgLogo.ToolTip = "RHB";
            imgLogo.AlternateText = "RHB";

            DateTime _dtLastLoginTime = new DateTime(2000, 12, 12);
            if (Session[CE.Global.General.LastLoginTime] != null)
            {
                _dtLastLoginTime = Convert.ToDateTime(Session[CE.Global.General.LastLoginTime]);
                divProviderInfo.InnerHtml = "Welcome " + Session[CE.Global.General.UserName].ToString() + ", RHB Singapore<br /><span>Last login date : " + _dtLastLoginTime.ToShortDateString() + " " + _dtLastLoginTime.ToShortTimeString() + "</span>";
            }
            else
            {
                divProviderInfo.InnerHtml = "Welcome " + Session[CE.Global.General.UserName].ToString() + ", RHB Singapore<br /><span>Last login date : first time </span>";
            }

            litTitlePage.Text = "RHB";
        }

        //CIMB
        else if (Session[CE.Global.General.ProviderCompanyId].ToString() == CE.Configuration.MyConfigurationManager.GetAppSettingValue("CIMBProviderCompanyID"))
        {
            imgLogo.ImageUrl = "~/Provider/images/logos/cimb.png";
            imgLogo.ToolTip = "CIMB";
            imgLogo.AlternateText = "CIMB";

            DateTime _dtLastLoginTime = new DateTime(2000, 12, 12);
            if (Session[CE.Global.General.LastLoginTime] != null)
            {
                _dtLastLoginTime = Convert.ToDateTime(Session[CE.Global.General.LastLoginTime]);
                divProviderInfo.InnerHtml = "Welcome " + Session[CE.Global.General.UserName].ToString() + ", CIMB Singapore<br /><span>Last login date : " + _dtLastLoginTime.ToShortDateString() + " " + _dtLastLoginTime.ToShortTimeString() + "</span>";
            }
            else
            {
                divProviderInfo.InnerHtml = "Welcome " + Session[CE.Global.General.UserName].ToString() + ", CIMB Singapore<br /><span>Last login date : first time </span>";
            }

            litTitlePage.Text = "CIMB";
        }
        else if (Session[CE.Global.General.ProviderCompanyId].ToString() == CE.Configuration.MyConfigurationManager.GetAppSettingValue("DAProviderCompanyId"))
        {
            imgLogo.ImageUrl = "~/Provider/images/logos/directasia.gif";
            imgLogo.ToolTip = "Direct Asia";
            imgLogo.AlternateText = "Direct Asia";

            DateTime _dtLastLoginTime = Convert.ToDateTime(Session[CE.Global.General.LastLoginTime].ToString());
            divProviderInfo.InnerHtml = "Welcome " + Session[CE.Global.General.UserName].ToString() + ", Direct Asia Singapore<br /><span>Last login date : " + _dtLastLoginTime.ToShortDateString() + " " + _dtLastLoginTime.ToShortTimeString() + "</span>";

            litTitlePage.Text = "Direct Asia";
        }
    }
}
